FROM python:3.9

# 设置时区
ENV TZ=Asia/Shanghai
RUN apt-get update && apt-get install -y tzdata && \
    ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
    echo $TZ > /etc/timezone && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# 复制项目依赖
COPY requirements.txt .

# 安装项目依赖
RUN pip install --no-cache-dir -r requirements.txt

# 复制项目文件
COPY . .

# 添加脚本权限
# RUN chmod +x /app/start.sh
RUN sed -i "s/\r//" /app/start.sh && chmod +x /app/start.sh

# 暴露端口
EXPOSE 8000

# 启动应用
# CMD ["bash","/app/start.sh"]
CMD ["python", "main.py"]